home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume6 / cc2ps < prev    next >
Encoding:
Internet Message Format  |  1989-03-22  |  5.8 KB

  1. Path: uunet!tektronix!tekgen!tekred!games
  2. From: games@tekred.CNA.TEK.COM
  3. Newsgroups: comp.sources.games
  4. Subject: v06i032:  cc2ps - convert carriage control to postscript
  5. Message-ID: <3749@tekred.CNA.TEK.COM>
  6. Date: 21 Mar 89 20:40:07 GMT
  7. Sender: billr@tekred.CNA.TEK.COM
  8. Lines: 178
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: John Chew <john@trigraph.uucp>
  12. Posting-number: Volume 6, Issue 32
  13. Archive-name: cc2ps
  14.  
  15.     [Here's a neat little script you may want to keep with the lp-posters
  16.      previously posted.  It lets you print them out on a PostScript
  17.      device.  -br]
  18.  
  19. #! /bin/sh
  20. # This is a shell archive.  Remove anything before this line, then unpack
  21. # it by saving it into a file and typing "sh file".  To overwrite existing
  22. # files, type "sh file -c".  You can also feed this as standard input via
  23. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  24. # will see the following message at the end:
  25. #        "End of shell archive."
  26. # Contents:  README cc2ps cc2ps.1
  27. # Wrapped by billr@saab on Tue Mar 21 11:38:12 1989
  28. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  29. if test -f 'README' -a "${1}" != "-c" ; then 
  30.   echo shar: Will not clobber existing file \"'README'\"
  31. else
  32. echo shar: Extracting \"'README'\" \(792 characters\)
  33. sed "s/^X//" >'README' <<'END_OF_FILE'
  34. XThis script (cc2ps) was written in order to display the line printer
  35. Xposters posted to comp.sources.games by Phillipe Bekaert 
  36. X<SAAAA02%BLEKUL11.BITNET> (volume 6, issue 29).  It has been tested
  37. Xunder 4.3 BSD on a VAX and A/UX 1.0 on a Macintosh IIx, with the
  38. XKorn and Bourne shells, and on an Apple LaserWriter II NTX and on
  39. Xan Apple LaserWriter Plus.
  40. X
  41. XInstall the script cc2ps and the man page cc2ps.1 wherever
  42. Xis appropriate to your system.  If you use the -p option to
  43. Xcc2ps, you must have `lpr' in your search path.
  44. X
  45. XComments, flames and bug reports to...
  46. X
  47. Xjohn j. chew, iii             phone: +1 416 425 3818     AppleLink: CDA0329
  48. Xtrigraph, inc., toronto, canada   {uunet!utai!utcsri,utgpu,utzoo}!trigraph!john
  49. Xdept. of math., u. of toronto     poslfit@{utorgpu.bitnet,gpu.utcs.utoronto.ca}
  50. END_OF_FILE
  51. if test 792 -ne `wc -c <'README'`; then
  52.     echo shar: \"'README'\" unpacked with wrong size!
  53. fi
  54. # end of 'README'
  55. fi
  56. if test -f 'cc2ps' -a "${1}" != "-c" ; then 
  57.   echo shar: Will not clobber existing file \"'cc2ps'\"
  58. else
  59. echo shar: Extracting \"'cc2ps'\" \(1333 characters\)
  60. sed "s/^X//" >'cc2ps' <<'END_OF_FILE'
  61. X#!/bin/sh
  62. X
  63. XPSBODY='
  64. X/ff{showpage hs vs scale lM tM translate 0 fs neg moveto} bind def
  65. X/lf{0 fs neg rmoveto currentpoint exch pop bM le{ff}if}bind def/s
  66. X{pop currentpoint 3 -1 roll show moveto}bind def/ccpr{/Courier
  67. Xfindfont setfont hs vs scale clippath pathbbox/tM exch def/rM exch def
  68. X/bM exch tM sub def/lM exch def lM tM translate rM lM sub( )stringwidth
  69. Xpop div 132 div hs mul dup/fs exch def/Courier findfont exch scalefont
  70. Xsetfont(%stdin)(r)file 132 string 0 0 moveto lf{1 index read{3 copy pop
  71. Xreadline{exch dup 48 eq{lf lf s}{dup 49 eq{ff s}{dup 43 eq{s}{dup 45 eq
  72. X{lf lf lf s}{lf s}ifelse}ifelse}ifelse}ifelse}{exit}ifelse}{exit}ifelse
  73. X}loop pop pop showpage}bind def ccpr'
  74. X
  75. XUSAGE="Usage: $0 [-6|-8] [-s scale] [-p] [file...]"
  76. X
  77. XLPI=6
  78. XPRINT=
  79. XSCALE=1.0
  80. X
  81. Xwhile [ $# != 0 ]
  82. X  do
  83. X  case $1 in
  84. X    -6) LPI=6; shift ;;
  85. X    -8) LPI=8; shift ;;
  86. X    -s) SCALE=$2; shift; shift ;;
  87. X    -p) PRINT=yup; shift ;;
  88. X    -*) echo "$USAGE"; exit 1 ;;
  89. X    *) break ;;
  90. X  esac
  91. X  done
  92. X
  93. XPSHEAD="%!
  94. X/hs $SCALE def/vs $SCALE 6 mul $LPI div def"
  95. X
  96. Xif [ $# = 0 ]
  97. X  then
  98. X    set foo -
  99. X    shift
  100. X  fi
  101. X
  102. Xif [ "$PRINT" ]
  103. X  then
  104. X    for file
  105. X      do
  106. X    {
  107. X    echo "$PSHEAD"
  108. X    echo "$PSBODY"
  109. X    cat "$file"
  110. X    } |lpr
  111. X      done
  112. X  else
  113. X    echo "$PSHEAD"
  114. X    echo "$PSBODY"
  115. X    cat $1
  116. X    shift
  117. X    for file
  118. X      do
  119. X        echo "1"
  120. X        cat "$file"
  121. X      done
  122. X  fi
  123. END_OF_FILE
  124. if test 1333 -ne `wc -c <'cc2ps'`; then
  125.     echo shar: \"'cc2ps'\" unpacked with wrong size!
  126. fi
  127. chmod +x 'cc2ps'
  128. # end of 'cc2ps'
  129. fi
  130. if test -f 'cc2ps.1' -a "${1}" != "-c" ; then 
  131.   echo shar: Will not clobber existing file \"'cc2ps.1'\"
  132. else
  133. echo shar: Extracting \"'cc2ps.1'\" \(1600 characters\)
  134. sed "s/^X//" >'cc2ps.1' <<'END_OF_FILE'
  135. X.TH cc2ps 1 Local
  136. X.SH NAME
  137. Xcc2ps \- convert line printer carriage control to PostScript
  138. X.SH SYNOPSIS
  139. X.B cc2ps
  140. X[
  141. X.B \-6
  142. X|
  143. X.B \-8
  144. X] [
  145. X.B \-s
  146. Xscale ] [
  147. X.B \-p
  148. X] [file...]
  149. X.SH DESCRIPTION
  150. XFiles formatted using line printer carriage control characters
  151. Xare converted to a form suitable for output to a PostScript device.
  152. X.PP
  153. XInput files should consist of newline-separated records.  Each
  154. Xrecord should start with a carriage control character, which should
  155. Xbe followed by at most 132 printing characters.  Carriage control
  156. Xcharacters `+', ` ', `0', '-' indicate that respectively 0, 1, 2 or
  157. X3 lines should be skipped before printing the current line.  Carriage
  158. Xcontrol character `1' causes a form feed (showpage) to be generated
  159. Xbefore printing the current line.
  160. X.PP
  161. XBy default, output is scaled to make 132 characters take up the
  162. Xwidth of the current clipping area.  An image that is too large
  163. Xto fit on one page will be split as necessary.
  164. X.PP
  165. XThe `\-6' and `\-8' option choose between simulating the aspect
  166. Xratio for a six lines per inch printer or for an eight lines per
  167. Xinch printer.  Six is the default.
  168. X.PP
  169. XThe `\-s' option gives a scaling factor for images.  The default
  170. Xvalue of 1.0 makes 132 characters fit the current page width.
  171. XGreater values will cause characters to be dropped off the right
  172. Xside of the page.  Lesser values will reduce long images to fit
  173. Xonto a single page.
  174. X.PP
  175. XThe `\-p' option pipes the resulting PostScript code to
  176. X.IR lpr (1).
  177. X.SH AUTHOR
  178. XJohn J. Chew <poslfit@gpu.utcs.UToronto.CA>, 20 March 1989
  179. X.SH BUGS
  180. XNone known, but contact the author (see above) if any are found.
  181. END_OF_FILE
  182. if test 1600 -ne `wc -c <'cc2ps.1'`; then
  183.     echo shar: \"'cc2ps.1'\" unpacked with wrong size!
  184. fi
  185. # end of 'cc2ps.1'
  186. fi
  187. echo shar: End of shell archive.
  188. exit 0
  189.